Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support variable tag in benchmark #375

Merged
merged 8 commits into from
Nov 14, 2023
Merged

Conversation

Cpaulyz
Copy link
Contributor

@Cpaulyz Cpaulyz commented Oct 17, 2023

Old configuration makes all devices have the same tag.

# 标签名的前缀
# TAG_NAME_PREFIX=tag_

# 定义设备标签值,所有设备相同,使用逗号分开,目前支持iotdb-0.12, iotdb-0.13, influxdb-2.x, timescaledb, tdengine
# DEVICE_TAGS=

New configuration automatically generates different tags for different devices. Tags will be generated based on the hash value of the deviceName.

# 标签名数量
# TAG_NUMBER=0

# 标签名前缀
# TAG_KEY_PREFIX=tag_

# 标签值前缀
# TAG_VALUE_PREFIX=value_

# 每个标签值的取值种数,使用逗号分开,设置个数应与标签名数量相等。例如TAG_NUMBER=2,TAG_VALUE_CARDINALITY=50,10,说明第一个标签名可能有50种值,第二个标签名可能有10种值
# TAG_VALUE_CARDINALITY=

For example:

# 25000device
# Tags: 品牌, 项目, 车型
TAG_NUMBER=3
TAG_KEY_PREFIX=tag_
TAG_VALUE_PREFIX=value_
TAG_VALUE_CARDINALITY=50,50,10

@liyuheng55555 liyuheng55555 self-requested a review October 27, 2023 06:32
Copy link
Collaborator

@liyuheng55555 liyuheng55555 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look.

@@ -72,4 +91,22 @@ public static List<List<String>> getClientFiles() {
public static void setClientFiles(List<List<String>> clientFiles) {
CLIENT_FILES = clientFiles;
}

public static Map<String, String> getTag(String deviceName) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add some comments to explain it's functionality and the return value.
And, getTags ?

return res;
}

public static Map<String, String> getTag(int deviceId) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTags

# 标签值前缀
# TAG_VALUE_PREFIX=value_

# 每个标签值的取值种数,使用逗号分开,设置个数应与标签名数量相等。例如TAG_NUMBER=2,TAG_VALUE_CARDINALITY=50,10,说明第一个标签名可能有50种值,第二个标签名可能有10种值
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you further describe what the complete path might look like in this scenario? Would the path be root.test.device.value_10.value_5.sensor?

private static final String TAG_VALUE_PREFIX = config.getTAG_VALUE_PREFIX();
private static final int TAG_NUMBER = config.getTAG_NUMBER();
private static final List<Integer> TAG_VALUE_CARDINALITY = config.getTAG_VALUE_CARDINALITY();
private static final long[] LEVEL_CARDINALITY = new long[TAG_VALUE_CARDINALITY.size() + 1];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use List too, to keep consistent with TAG_VALUE_CARDINALITY

Copy link
Collaborator

@liyuheng55555 liyuheng55555 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me ~

@liyuheng55555 liyuheng55555 merged commit 220d4ef into thulab:master Nov 14, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants